package com.bytedance.common.a;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;

import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListSet;

final class c {
    ConcurrentMap a;
    ConcurrentMap b;
    ConcurrentSkipListSet c;
    String d;
    int e;
    boolean f;
    private Context g;
    private BroadcastReceiver h;

    c(Context arg3, boolean arg4) {
        this.d = null;
        this.e = -2;
        this.f = false;
        this.h = new d(this);
        this.a = new ConcurrentHashMap();
        this.b = new ConcurrentHashMap();
        this.c = new ConcurrentSkipListSet();
        this.g = arg3;
        this.f = arg4;
        IntentFilter v0 = new IntentFilter();
        v0.addAction("android.net.conn.CONNECTIVITY_CHANGE");
        arg3.registerReceiver(this.h, v0);
    }

    static void a(Map arg4) {
        if (arg4 != null && arg4 != null) {
            try {
                Iterator v2 = arg4.entrySet().iterator();
                while (v2.hasNext()) {
                    Object v0_1 = v2.next();
                    f v3 = com.bytedance.common.a.e.a();
                    if (v3 == null) {
                        continue;
                    }

                    ((com.bytedance.common.a.a) ((Map.Entry) v0_1).getValue()).a();
                    v3.a(((String) ((Map.Entry) v0_1).getKey()));
                }
            } catch (Throwable v0) {
                v0.printStackTrace();
            }
        }
    }

    final ConcurrentMap a() {
        ConcurrentMap v0 = i.b(this.g) == 0 ? this.a : this.b;
        return v0;
    }

    static void b(Map arg2) {
        if (arg2 != null && arg2 != null) {
            try {
                Iterator v1 = arg2.entrySet().iterator();
                while (v1.hasNext()) {
                    Object v0_1 = v1.next();
                    if (v0_1 == null) {
                        continue;
                    }

                    ((com.bytedance.common.a.a) ((Map.Entry) v0_1).getValue()).a();
                }
            } catch (Throwable v0) {
                v0.printStackTrace();
            }
        }
    }
}

